//
//  ContactViewController.m
//  MoXiProject
//
//  Created by 周筱雯 on 2017/7/3.
//  Copyright © 2017年 周筱雯. All rights reserved.
//

#import "ContactViewController.h"

@interface ContactViewController ()

<
    UITableViewDataSource,
    UITableViewDelegate
>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) UIImageView *picImage;//log图片
@property (nonatomic, strong) UILabel *nameLabel;//版本号
@property (nonatomic, strong) UILabel *titleLabel;//群号
@property (nonatomic, copy) NSString *fileString;//内容
@property (nonatomic, strong) UILabel *titleLabel2;//群号
@end

@implementation ContactViewController

- (void)dealloc {
    _tableView.delegate = nil;
    _tableView.dataSource = nil;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;
    self.title = @"联系我们";
    [self picImage];
    [self nameLabel];
    //    [self titleLabel];
    [self titleLabel2];
    self.fileString = @"";
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_picImage];//log图
    [self.view addSubview:_nameLabel];//版本
    //    [self.view addSubview:_titleLabel];//群号
    [self.view addSubview:_titleLabel2];
    //    [self.view addSubview:self.tableView];
    
    UILabel *lblQQ = [[UILabel alloc] initWithFrame:CGRectMake(20, self.picImage.frame.origin.y + self.picImage.frame.size.height + 10, self.picImage.frame.size.width, 22)];
    lblQQ.text = @"QQ:1765656224";
    [lblQQ setFont:[UIFont systemFontOfSize:14]];
    lblQQ.textColor = [UIColor blackColor];
    [self.view addSubview:lblQQ];
    
    UILabel *lblEmail = [[UILabel alloc] initWithFrame:CGRectMake(lblQQ.frame.origin.x, lblQQ.frame.origin.y + lblQQ.frame.size.height, lblQQ.frame.size.width, lblQQ.frame.size.height)];
    lblEmail.text = @"邮箱:xiaoewn@163.com";
    [lblEmail setFont:[UIFont systemFontOfSize:14]];
    lblEmail.textColor = [UIColor blackColor];
    [self.view addSubview:lblEmail];
    
    
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}
#pragma mark-set/get
-(UITableView *)tableView{
    if (_tableView == nil) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 280, DEF_DEVICE_WIDTH, DEF_DEVICE_HEIGHT - 285) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.backgroundColor = [UIColor whiteColor];
        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"updateCell"];
        _tableView.tableFooterView = [[UIView alloc]init];
        _tableView.separatorStyle = UITableViewCellSelectionStyleNone;//隐藏线
        /**
         *  将tableview的分割线补满
         */
        if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
            [_tableView setSeparatorInset:UIEdgeInsetsZero];
        }
        if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) {
            [_tableView setLayoutMargins:UIEdgeInsetsZero];
        }
    }
    return _tableView;
}
#pragma mark mainTableView delegate/datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    //    self.fileString = [NSString stringWithFormat:@"1.增加人气歌曲投票页面\n2.界面跳转调整"];
    //    if ([self.fileString isEqualToString:@""]) {
    return 10;
    //    } else{
    //        if ([[UpdateMessageTableViewCell class] neirongTableCellWithHeight:self.fileString]>65) {
    //            if ([[UIScreen mainScreen] bounds].size.width > 375) {
    //                return [[UpdateMessageTableViewCell class] neirongTableCellWithHeight:self.fileString] + 150;
    //            }else if ([[UIScreen mainScreen] bounds].size.width < 375) {
    //                return [[UpdateMessageTableViewCell class] neirongTableCellWithHeight:self.fileString] + 190;
    //            }else
    //                return [[UpdateMessageTableViewCell class] neirongTableCellWithHeight:self.fileString];
    //        } else  return [[UpdateMessageTableViewCell class] neirongTableCellWithHeight:self.fileString];
    //    }
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"updateCell" forIndexPath:indexPath];
    //    cell.updateMessageLabel.text = self.fileString;
    cell.selectionStyle = UITableViewCellAccessoryNone; /**< 拒绝选中 */
    return cell;
}
//cell点击
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}
- (UIImageView *)picImage {
    if (!_picImage) {
        
        _picImage = [[UIImageView alloc] initWithFrame:CGRectMake(20 , 30, DEF_DEVICE_WIDTH - 40, (DEF_DEVICE_WIDTH - 40) * 3 / 5)];
        //        _picImage.backgroundColor = [];
        _picImage.image = [UIImage imageNamed:@"luckyBall"];
        
        
    }
    return _picImage;
}

- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 210, DEF_DEVICE_WIDTH - 40, 30)];
        _nameLabel.textColor = [UIColor blackColor];
        //        NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
        //        _nameLabel.text = [NSString stringWithFormat:@"Current version number:ver. %@",[infoDictionary objectForKey:@"CFBundleShortVersionString"]];
        _nameLabel.font = [UIFont systemFontOfSize:15.0];
        _nameLabel.textAlignment = 1;
    }
    return _nameLabel;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 250, DEF_DEVICE_WIDTH - 40, 40)];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.font = [UIFont systemFontOfSize:15.0];
        //        _titleLabel.text      = @"产品用户QQ群: 414860233";
        _titleLabel.text      = @"106彩票(六合彩版)\n ";
        _titleLabel.numberOfLines = 0;
        _titleLabel.textAlignment = 1;
    }
    return _titleLabel;
}
- (UILabel *)titleLabel2 {
    if (!_titleLabel2) {
        _titleLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(40, 330, DEF_DEVICE_WIDTH - 80, 60)];
        _titleLabel2.textColor = [UIColor blackColor];
        _titleLabel2.font = [UIFont systemFontOfSize:14.0];
        _titleLabel2.text      = @"所有信息和彩票活动都与苹果公司(Apple Inc)无关。";
        _titleLabel2.numberOfLines = 0;
        _titleLabel2.textAlignment = 1;
    }
    return _titleLabel2;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
